//引入路由
import UserCenter from "@/views/usercenter/UserCenter.vue";
import { createRouter,createWebHashHistory } from "vue-router";

//引入页面

const Login = ()=>import("@/views/Login.vue")
const Profile = ()=>import('@/views/usercenter/Profile.vue')
const Settings = ()=>import('@/views/usercenter/Setting.vue')
const usercenter = ()=>import('@/views/usercenter/UserCenter.vue')

//路由配置
const routeConfig = [
    //根路径
    {path:'/',redirect:'/login'},
    {path:'/login',component:Login},
    //用户中心
    {
        path:'/user',
        component:UserCenter,
        redirect:'/user/profile',
        children:[
            {
                path:'profile',
                component:Profile
            },
            {
                path:'settings',
                component:Settings
            }
        ]
    }
]

//创建实例化路由
const router = createRouter({
    history:createWebHashHistory(),
    routes:routeConfig
})

//对外暴露实例化路由对象
export default router